package cn.sumpu.app.guoguojie.biz.impl;
import java.util.List;

import cn.sumpu.app.guoguojie.biz.StrollBiz;
import cn.sumpu.app.guoguojie.dao.StrollDao;
import cn.sumpu.app.guoguojie.domain.Stroll;
import cn.sumpu.app.guoguojie.domain.StrollClass;
import cn.sumpu.app.guoguojie.domain.StrollGoods;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;


public class StrollBizImpl implements StrollBiz{
	
	private StrollDao strollDao;

	public void setStrollDao(StrollDao strollDao) {
		this.strollDao = strollDao;
	}

	//添加新专辑
	@Override
	public void insertStroll(Stroll stroll)throws AppBusinessException {
		strollDao.insertStroll(stroll);
	}
	//添加新的专辑分类
	@Override
	public void insertStrollClass(StrollClass strollClass)throws AppBusinessException {
		strollDao.insertStrollClass(strollClass); 
	}
	
	//查询逛街的所有专辑
	@Override
	public List<Stroll> selectStrollList()throws AppBusinessException {
		
		return strollDao.selectStrollList();
	}
	//查询逛街专辑详情
	@Override
	public Stroll selectStroll(String strollId)throws AppBusinessException {
		return strollDao.selectStroll(strollId);
	}
	//查询分类详情
	@Override
	public StrollClass selectStrollClass(String classId)throws AppBusinessException {
		return strollDao.selectStrollClass(classId);
	}
	
	//更新专辑
	@Override
	public void updateStrollById(Stroll stroll)throws AppBusinessException {
		
		strollDao.updateStrollById(stroll);
	}
	//删除专辑
	@Override
	public void deleteStrollById(String identifier)throws AppBusinessException { 
		strollDao.deleteStrollGoodsByStrollId(identifier);
		strollDao.deleteStrollClassByStrollId(identifier);
		strollDao.deleteStrollById(identifier);
	}
	//更新分类
	@Override
	public void updateStrollClassById(StrollClass strollClass)throws AppBusinessException {
		
		strollDao.updateStrollClassById(strollClass);
	}
	//删除分类
	@Override
	public void deleteStrollClassById(String identifier)throws AppBusinessException { 
		strollDao.deleteStrollGoodsByClassId(identifier);
		strollDao.deleteStrollClassById(identifier);
	}
	//删除商品
	@Override
	public void deleteStrollGoodsById(String identifier)throws AppBusinessException { 
		strollDao.deleteStrollGoodsById(identifier);
	}
	
	//查询专辑的分类集合
	@Override
	public List<StrollClass> selectStrollClassList(String strollId)throws AppBusinessException {
		
		return strollDao.selectStrollClassList(strollId);
	}
	//添加商品
	@Override
	public void insertStrollGoods(StrollGoods strollGoods)throws AppBusinessException {
		strollDao.insertStrollGoods(strollGoods);
	}
	//查询商品详情
	@Override
	public StrollGoods selectStrollGoods(String goodsId) throws AppBusinessException {
		return strollDao.selectStrollGoods(goodsId);
	}
	//更新商品
	@Override
	public void updateStrollGoodsById(StrollGoods strollGoods)throws AppBusinessException {
		
		strollDao.updateStrollGoodsById(strollGoods);
	}
	
}

